<?php
namespace Admin\Controller;
use Think\Controller;
class OrderController extends Controller {
	public function __construct(){
		parent::__construct();
		if(!$_SESSION['admin_is_login']){
			$this->error('还未登录，请登录',U('admin/auth/do_login'));
		}
	}
    public function index(){
    	$order_model = M('orders');
    	$count = $order_model->count();
    	$Page = new \Org\Util\Page($count,10);
    	$orders = $order_model->limit($Page->firstRow.','.$Page->listRows)->select();
    	$this->assign('orders',$orders);
    	$this->assign('page',$Page->show());
    	$this->display();
    }
    public function view($id){
        $this->assign('order',M('orders')->where('id ='.$id)->find());
        $this->assign('order_product',M('orders_product')->join('product_catalog ON orders_product.product_cata_id = product_catalog.id')->where('order_id ='.$id)->select());
        $this->display();
    }
}